package com.wyclabs.web.controller;

import com.wyclabs.api.UserResource;
import com.wyclabs.cache.redis.RedisClient;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

/**
 * @author rs
 * @date 2019/10/9 9:12
 */
@RestController
@AllArgsConstructor
public class UserController {

    private final UserResource userResource;

    private final RedisClient redisClient;

    @RequestMapping("/t1")
    public String test() {
        try {
            TimeUnit.SECONDS.sleep(8L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
//        userResource.test();
        return "success";
    }

    @RequestMapping("/t2")
    public String t2() {
        return redisClient.get("test").toString();
    }

}
